import 'package:eh_mobile/common/utils/toast/bnw_toast.dart';
import 'package:eh_mobile/pages/index.dart';
import 'package:get/get.dart';
import 'package:flutter/services.dart';

class DeviceInfoController extends GetxController {
  DeviceInfoController();

  late String deviceName = Get.arguments;
  String areaName = '客厅';
  List<String> personalDeviceList = [
    '摆风',
    '强力模式',
    '节能模式',
    '提示音',
    '干燥模式',
    '智慧眼',
    '电辅热',
    '舒省',
    '自然风',
    '显示屏/指示灯'
  ];
  bool isHiddenPerson = false;
  String personalDeviceViewId = 'personalDeviceViewId';

  _initData() {
    // update(["device_info"]);
  }

  void onTap() {}

  // 卡片点击事件
  void clickCardAction(String title, content) {
    if (title == '设备名称') {
      Get.to(const DeviceNamePage(), arguments: Get.arguments)?.then((value) {
        if (value != null) {
          deviceName = value;
          update(["device_info"]);
        }
      });
    } else if (title == '设备区域') {
      Get.to(const DeviceAreaPage(), arguments: areaName)?.then((value) {
        if (value != null) {
          areaName = value;
          update(["device_info"]);
        }
      });
    } else if (title == '制造商') {
      BnwToast.showView(Get.context!, infoStr: '制造商已复制');
      Clipboard.setData(ClipboardData(text: content));
    } else if (title == '型号') {
      BnwToast.showView(Get.context!, infoStr: '型号已复制');
      Clipboard.setData(ClipboardData(text: content));
    } else if (title == '设备ID') {
      BnwToast.showView(Get.context!, infoStr: '设备ID已复制');
      Clipboard.setData(ClipboardData(text: content));
    }
  }

  // @override
  // void onInit() {
  //   super.onInit();
  // }

  @override
  void onReady() {
    super.onReady();
    _initData();
  }

// @override
// void onClose() {
//   super.onClose();
// }
}
